package externalflame.systemdesign.newsfeed.dao;


import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface FriendDao {
    @Insert("insert into friend (from_user_id, to_user_id) values (#{fromUserId}, #{toUserId})")
    Boolean add(@Param("fromUserId") Long fromUserId, @Param("toUserId") Long toUserId);

    @Delete("delete from friend where from_user_id = #{fromUserId} and to_user_id = #{toUserId}")
    Boolean remove(@Param("fromUserId") Long fromUserId, @Param("toUserId") Long toUserId);

    @Select("select to_user_id from friend where from_user_id = #{userId}")
    List<Long> getFollowings(@Param("userId") Long userId);

    @Select("select from_user_id friend where to_user_id = #{userId}")
    List<Long> getFollowers(@Param("userId") Long userId);
}
